﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using Microsoft.Practices.Composite.UnityExtensions;
using Microsoft.Practices.Composite.Modularity;

using Might.Infrastructure.Services;

using Might.Services;
using Might.Core;
using Might.ViewsTabControl;
using Might.UIControls;

namespace Might {

    /// <summary>
    /// This class starting and initializing Composite Application Framework and main application window.
    /// </summary>
    public class Bootstrapper : UnityBootstrapper {

        /// <summary>
        /// Creates the main application Window, ses <see cref="Shell"/>
        /// </summary>
        /// <returns></returns>
        protected override DependencyObject CreateShell() {
            Shell shell = Container.Resolve<Shell>();
            Application.Current.RootVisual = shell;                        
            return shell;            
        }       

        /// <summary>
        /// Creates and initializes the modules of this application.
        /// </summary>
        protected override IModuleCatalog GetModuleCatalog() {
            var catalog = new ModuleCatalog();
            catalog.AddModule( typeof( ServicesModule ) )
                .AddModule( typeof( CoreModule ) , "ServicesModule" )
                .AddModule( typeof( UIControlsModule ) , "CoreModule" )
                .AddModule( typeof( ViewsTabControlModule ) , "UIControlsModule" );
                
            return catalog;
        }

        protected override void ConfigureContainer() {
            base.ConfigureContainer();
            
            CoreServices.Container = Container;            
            
        }
        
    
    }
        
}
